package controller

import (
	"net/http"
	"text/template"
)

// 公共模板加载
func tpl(filename string) *template.Template {
	t := template.Must(template.ParseFiles(
		filename,
		"./templates/common_header.html",
		"./templates/common_left.html",
		"./templates/common_nav.html",
		"./templates/common_footer.html",
	))
	return t
}

// 错误页面
func err(w http.ResponseWriter, error string) {
	t := tpl("./templates/error.html")
	t.Execute(w, error)
}
